]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Port to the new mutter-based barrier wrappers
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 30 Jul 2012 17:02:33 +0000 (14:02 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 8 Feb 2013 19:27:42 +0000 (14:27 -0500)
As pressure barriers need a signalling mechanism to provide
information about when and where they are hit, an object which
provides a signal is a more appropriate abstraction for a pointer
barrier than a functional ID-based approach. Mutter has gained
pointer barrier wrappers, so use its objects instead of ours.

https://bugzilla.gnome.org/show_bug.cgi?id=677215

configure.ac
js/ui/layout.js
src/shell-global.c
src/shell-global.h

index dd3e54a6380788169518de6eea4109cbbbd5759d..0ed832d769af35254ff9860a4a6410e2224190f0 100644 (file)
@@ -132,14 +132,6 @@ AC_SUBST([GNOME_KEYBINDINGS_KEYSDIR])
 
 GOBJECT_INTROSPECTION_CHECK([$GOBJECT_INTROSPECTION_MIN_VERSION])
 
-saved_CFLAGS=$CFLAGS
-saved_LIBS=$LIBS
-CFLAGS=$GNOME_SHELL_CFLAGS
-LIBS=$GNOME_SHELL_LIBS
-AC_CHECK_FUNCS(XFixesCreatePointerBarrier)
-CFLAGS=$saved_CFLAGS
-LIBS=$saved_LIBS
-
 MUTTER_GIR_DIR=`$PKG_CONFIG --variable=girdir libmutter`
 MUTTER_TYPELIB_DIR=`$PKG_CONFIG --variable=typelibdir libmutter`
 AC_SUBST(MUTTER_GIR_DIR)
index 6ce509cd18d77ccb3fe4763160544c7a3132bf84..09e14fe6d986459aab01127da31b825fcaab3561 100644 (file)
@@ -112,8 +112,8 @@ const LayoutManager = new Lang.Class({
         this._keyboardIndex = -1;
         this._hotCorners = [];
         this._background = null;
-        this._leftPanelBarrier = 0;
-        this._rightPanelBarrier = 0;
+        this._leftPanelBarrier = null;
+        this._rightPanelBarrier = null;
 
         this._inOverview = false;
         this._updateRegionIdle = 0;
@@ -289,24 +289,27 @@ const LayoutManager = new Lang.Class({
     },
 
     _updatePanelBarriers: function() {
-        if (this._leftPanelBarrier)
-            global.destroy_pointer_barrier(this._leftPanelBarrier);
-        if (this._rightPanelBarrier)
-            global.destroy_pointer_barrier(this._rightPanelBarrier);
+        if (this._leftPanelBarrier) {
+            this._leftPanelBarrier.destroy();
+            this._leftPanelBarrier = null;
+        }
+
+        if (this._rightPanelBarrier) {
+            this._rightPanelBarrier.destroy();
+            this._rightPanelBarrier = null;
+        }
 
         if (this.panelBox.height) {
             let primary = this.primaryMonitor;
-            this._leftPanelBarrier =
-                global.create_pointer_barrier(primary.x, primary.y,
-                                              primary.x, primary.y + this.panelBox.height,
-                                              1 /* BarrierPositiveX */);
-            this._rightPanelBarrier =
-                global.create_pointer_barrier(primary.x + primary.width, primary.y,
-                                              primary.x + primary.width, primary.y + this.panelBox.height,
-                                              4 /* BarrierNegativeX */);
-        } else {
-            this._leftPanelBarrier = 0;
-            this._rightPanelBarrier = 0;
+
+            this._leftPanelBarrier  = new Meta.Barrier({ display: global.display,
+                                                         x1: primary.x, y1: primary.y,
+                                                         x2: primary.x, y2: primary.y + this.panelBox.height,
+                                                         directions: Meta.BarrierDirection.POSITIVE_X });
+            this._rightPanelBarrier = new Meta.Barrier({ display: global.display,
+                                                         x1: primary.x + primary.width, y1: primary.y,
+                                                         x2: primary.x + primary.width, y2: primary.y + this.panelBox.height,
+                                                         directions: Meta.BarrierDirection.NEGATIVE_X });
         }
     },
 
index 1220346972715ae7c911b4de051a0207ccd0e507..7344334711b62c4dd2560b39a9c87ada8ff7ee95 100644 (file)
@@ -1002,54 +1002,6 @@ shell_global_end_modal (ShellGlobal *global,
   meta_plugin_end_modal (global->plugin, timestamp);
 }
 
-/**
- * shell_global_create_pointer_barrier:
- * @global: a #ShellGlobal
- * @x1: left X coordinate
- * @y1: top Y coordinate
- * @x2: right X coordinate
- * @y2: bottom Y coordinate
- * @directions: The directions we're allowed to pass through
- *
- * If supported by X creates a pointer barrier.
- *
- * Return value: value you can pass to shell_global_destroy_pointer_barrier()
- */
-guint32
-shell_global_create_pointer_barrier (ShellGlobal *global,
-                                     int x1, int y1, int x2, int y2,
-                                     int directions)
-{
-#if HAVE_XFIXESCREATEPOINTERBARRIER
-  return (guint32)
-    XFixesCreatePointerBarrier (global->xdisplay,
-                                DefaultRootWindow (global->xdisplay),
-                                x1, y1,
-                                x2, y2,
-                                directions,
-                                0, NULL);
-#else
-  return 0;
-#endif
-}
-
-/**
- * shell_global_destroy_pointer_barrier:
- * @global: a #ShellGlobal
- * @barrier: a pointer barrier
- *
- * Destroys the @barrier created by shell_global_create_pointer_barrier().
- */
-void
-shell_global_destroy_pointer_barrier (ShellGlobal *global, guint32 barrier)
-{
-#if HAVE_XFIXESCREATEPOINTERBARRIER
-  g_return_if_fail (barrier > 0);
-
-  XFixesDestroyPointerBarrier (global->xdisplay, (PointerBarrier)barrier);
-#endif
-}
-
 /* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
  *
  * Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering
index 2dd98ef76d1a1b427c3256d102e348503e74ab89..88b40bed58ddb0cf01c7982f2b4e42a61f04af15 100644 (file)
@@ -71,15 +71,6 @@ void    shell_global_set_cursor              (ShellGlobal         *global,
                                               ShellCursor          type);
 void    shell_global_unset_cursor            (ShellGlobal         *global);
 
-guint32 shell_global_create_pointer_barrier  (ShellGlobal         *global,
-                                              int                  x1,
-                                              int                  y1,
-                                              int                  x2,
-                                              int                  y2,
-                                              int                  directions);
-void    shell_global_destroy_pointer_barrier (ShellGlobal         *global,
-                                              guint32              barrier);
-
 void    shell_global_get_pointer             (ShellGlobal         *global,
                                               int                 *x,
                                               int                 *y,